<template>
  <div class="wra">
    <div id="detailgoodsinfo">
      <div>
        <p class="goodstitle">{{ goodstitle }}</p>
        <span class="price">{{ price }}</span>
        <span class="oldPrice">{{ oldPrice }}</span>
        <span
          :class="{ discountDesc: discountDesc ? true : false }"
          :style="{ backgroundColor: discountBgColor }"
          >{{ discountDesc }}</span
        >
      </div>
      <div class="top">
        <span v-for="(item, index) in columns" :key="index">{{ item }}</span>
      </div>
      <div class="services">
        <span v-for="(item, index) in services" :key="index">
          <img :src="item.icon" alt="" class="icon" />{{ item.name }}</span
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  // 组件名称
  name: "detail_goodsinfo", // 组件参数 接收来自父组件的数据
  props: {
    goodstitle: {
      type: String,
      default() {
        return "";
      },
    },
    oldPrice: {
      type: String,
      default() {
        return "";
      },
    },
    price: {
      type: String,
      default() {
        return "";
      },
    },
    discountDesc: {
      type: String,
      default() {
        return "";
      },
    },
    discountBgColor: {
      type: String,
      default() {
        return "";
      },
    },
    columns: {
      type: Array,
      default() {
        return [];
      },
    },
    services: {
      type: Array,
      default() {
        return [];
      },
    },
  }, // 局部注册的组件
  components: {}, // 组件状态值
  data() {
    return {};
  },
};
</script>
<style scoped>
#detailgoodsinfo {
  padding: 0 5px;
}
.wra {
  border-bottom: 5px solid #eee;
  background-color: #fff;
}
.goodstitle {
  margin-top: 10px;
  font-size: 15px;
  margin-bottom: 8px;
}
.price {
  color: palevioletred;
  font-size: 18px;
  margin: 0px 4px 0 10px;
}
.oldPrice {
  font-size: 12px;
  color: grey;
  text-decoration: line-through;
}
.discountDesc {
  padding: 2px 12px;
  color: #fff;
  border-radius: 30px;
  margin-left: 5px;
}
.top {
  margin-top: 20px;
  padding-bottom: 10px;
  display: flex;
  font-size: 12px;
  color: grey;
  justify-content: space-between;
  border-bottom: 1px solid #eee;
}
.services {
  display: flex;
  font-size: 14px;
  color: #000;
  justify-content: space-between;
  padding: 20px 0;
}
.icon {
  width: 14px;
}
</style>